<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// 数组向右移动k个元素
	function arrayMove(arr,k){
		if(arr.length === 0){
			return []
		}
		if (k === 0){
			return [...arr]
		}
		const rightPart = arr.slice(-k)
		const leftPart = arr.slice(0,arr.length - k)
		return [...rightPart,...leftPart]
	}
	
	let arr = [1,2,3,4,5,6,7]
	console.log(arrayMove(arr,5))
</script>
</html>